package com.example.tests;

public class ContactData implements Comparable<ContactData> {
	
	private String firstname;
	private String lastname;
	private String address;
	private String hometelephone;
	private String mobiletelephone;
	private String worktelephone;
	private String email;
	private String email2;
	private String bday;
	private String bmonth;
	private String byear;
	private String group;
	private String address2;
	private String telephone2;
	
    public ContactData(String firstname, String lastname, String address,
            String hometelephone, String mobiletelephone, String worktelephone,
            String email, String email2, String bday, String bmonth,
            String byear, String group, String address2, String telephone2) {
    this.firstname = firstname;
    this.lastname = lastname;
    this.address = address;
    this.hometelephone = hometelephone;
    this.mobiletelephone = mobiletelephone;
    this.worktelephone = worktelephone;
    this.email = email;
    this.email2 = email2;
    this.bday = bday;
    this.bmonth = bmonth;
    this.byear = byear;
    this.group = group;
    this.address2 = address2;
    this.telephone2 = telephone2;
    }
    
	public ContactData() {
	}
	
	@Override
	public int hashCode() {
		int result = 1;
		return result;
	}

	@Override
	public String toString() {
		return "ContactData [firstname=" + firstname + ", lastname=" + lastname + "]";
	}
	
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		 ContactData other = (ContactData) obj;
         if (firstname == null) {
                 if (other.firstname != null)
                         return false;
         } else if (!firstname.equals(other.firstname))
                 return false;
         if (lastname == null) {
                 if (other.lastname != null)
                         return false;
         } else if (!lastname.equals(other.lastname))
                 return false;
         return true;
	}

	@Override
	public int compareTo(ContactData other) {
		int lastNameEquals = this.lastname.toLowerCase().compareTo(other.lastname.toLowerCase());
        if (lastNameEquals == 0) {
                int firstNameEquals = this.firstname.toLowerCase().compareTo(other.firstname.toLowerCase());
                return firstNameEquals;
        } else {
                return lastNameEquals;
        }}
	
	public ContactData withFirstname(String firstname) {
		this.firstname = firstname;
		return this;
	}

	public ContactData withLastname(String lastname) {
		this.lastname = lastname;
		return this;
	}

	public ContactData withAddress(String address) {
		this.address = address;
		return this;
	}

	public ContactData withHometelephone(String hometelephone) {
		this.hometelephone = hometelephone;
		return this;
	}
	
	public ContactData withMobiletelephone(String mobiletelephone) {
		this.mobiletelephone = mobiletelephone;
		return this;
	}
	
	public ContactData withWorktelephone(String worktelephone) {
		this.worktelephone = worktelephone;
		return this;
	}

	public ContactData withEmail(String email) {
		this.email = email;
		return this;
	}

	public ContactData withEmail2(String email2) {
		this.email2 = email2;
		return this;
	}
	
	public ContactData withBday(String bday) {
        this.bday = bday;
        return this;
	}

	public ContactData withBmonth(String bmonth) {
        this.bmonth = bmonth;
        return this;
	}

	public ContactData withByear(String byear) {
        this.byear = byear;
        return this;
	}
	
    public ContactData withgroup(String contactgroup) {
        this.group = contactgroup;
        return this;
    }

	public ContactData withAddress2(String address2) {
		this.address2 = address2;
		return this;
	}

	public ContactData withTelephone2(String telephone2) {
		this.telephone2 = telephone2;
		return this;
	}
	
	public String getFirstname() {
		return firstname;
	}

	public String getLastname() {
		return lastname;
	}

	public String getAddress() {
		return address;
	}

	public String getHometelephone() {
		return hometelephone;
	}

	public String getMobiletelephone() {
		return mobiletelephone;
	}

	public String getWorktelephone() {
		return worktelephone;
	}

	public String getEmail() {
		return email;
	}

	public String getEmail2() {
		return email2;
	}

	public String getBday() {
		return bday;
	}

	public String getBmonth() {
		return bmonth;
	}

	public String getByear() {
		return byear;
	}
	
    public String getGroup() {
        return group;
    }

	public String getAddress2() {
		return address2;
	}

	public String getTelephone2() {
		return telephone2;
	}
		
}